from LinearAlgebra.Vector import Vector

if __name__ == '__main__':
    vec1 = Vector([2, 1])
    print(vec1)
    print(len(vec1))
    print("vec[0] = {}, vec[1] = {}".format(vec1[0], vec1[1]))


    vec2 = Vector([3, 4])
    print("{} + {} = {}".format(vec1, vec2, vec1 + vec2))
    print("{} - {} = {}".format(vec1, vec2, vec1 - vec2))
    print("{} * {} = {}".format(vec1, 3, vec1 * 3))
    print("{} * {} = {}".format(3, vec1, 3 * vec1))
    print("+{} = {}".format(vec1, +vec1))
    print("-{} = {}".format(vec1, -vec1))
    print(Vector.zero(2))
    print(vec1.norm())
    print(vec2.norm())
    try:
        print(vec1.normalize())
    except ZeroDivisionError:
        print("Cannot normalize zero vector {}.".format(vec1))

    print(vec1.dot(vec2))